package report

import report.Activity;
import report.ActivityController;
import grails.test.*

class ActivityControllerTests extends ControllerUnitTestCase {
    protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }

	void testAuth(){
		mockDomain(Activity, [new Activity(nature:"ensino",theme:"bdd",target:"alunos", description:"xpto",reasons:"melhoria",expectedResults:"a b c", actualResults:"a b d",comments:"nothing",partners:"nothing",time:new Date().parse("d/M/yyyy","21/3/2008"), plan:null)])
		//dados válidos		
		controller.params.login = "admin"
		controller.params.password = "teste123"
		controller.doIt()
		assertEquals "index" , redirectParams.controller
		
		//dados não existentes
		controller.params.login = mockParams.login + "umLoginErrado"
		controller.params.password = mockParams.password + "umaSenhaErrada"
		controller.doIt()
		assertEquals "login" , redirectParams.action
		
		//dados em branco
		controller.params.login = ""
		controller.params.password = ""
		controller.doIt()
		
	}
	
}
